#define  _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
int main()
{
    int n=0, m=0;
    scanf("%d %d", &n, &m);
    int a[10][10];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            scanf("%d", &a[i][j]);
        }
        printf("\n");
    }
    for (int t = 0; t < m; t++)
    {
        for (int y = 0; y < n; y++)
        {
            printf("%d", a[t][y]);
        }
        printf("\n");
    }
    return 0;
}